var mongoose = require('mongoose');
var Schema = mongoose.Schema;
mongoose.connect('mongodb://dc:dc19920313@localhost/social',function(err){
  if(err){
    console.log(err);
  }
  else{
    console.log('connect to mongodb succeed');
  }
});
/*
    我们的目标是: 智能问卷!
*/
var questionSchema = new Schema({
  author:{type: String},
  /*出题人的Id*/
  title: {type: String},
  /*问题的题目,由提问者指定*/
  time: {type: String},
  /*问题发布的时间,处理之后方便阅读的时间yyyy-mm-dd*/
  _time:{type: Number},
  /*用于比较的数字时间*/
  choices: [{
    text: {type: String},
    /*选项的文本描述,由提问者指定*/
    members: [String]
    /*选择该选项的用户Id的列表*/
  }],
  supporter:[String],
  /*支持这道题的memberId列表*/
  protester:[String]
  /*反对这道题的memberId列表*/
});
var questionModel = mongoose.model('question',questionSchema);
exports.questionModel  = questionModel;
